<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<link href="/zero/resources/dijit/themes/tundra/tundra.css" type="text/css" rel="stylesheet" />
<link href="/zero/resources/styles/standard.css" media="screen" type="text/css" rel="stylesheet" />
<link href="/zero/resources/images/favicon.ico" rel="SHORTCUT ICON" />
<script type="text/javascript">
	var djConfig = {
		parseOnLoad : false,
		isDebug : false,
		locale : 'zh'
	};
</script>
<script type="text/javascript" src="/zero/resources/dojo/dojo.js"></script>
<script type="text/javascript" src="/zero/resources/spring/Spring.js"></script>
<script type="text/javascript" src="/zero/resources/spring/Spring-Dojo.js"></script>
<script type="text/javascript" language="JavaScript">
	dojo.require("dojo.parser");
</script>

</head>
<body>

	<script type="text/javascript">
		dojo.require('dijit.TitlePane');
	</script>

	<spring:message code="task_detail" htmlEscape="false" javaScriptEscape="true" var="panel_title" />

	<div id="_title_fc_com_ibm_zero_domain_task_id">
		<script type="text/javascript">
			Spring.addDecoration(new Spring.ElementDecoration({
				elementId : '_title_fc_com_ibm_zero_domain_task_id',
				widgetType : 'dijit.TitlePane',
				widgetAttrs : {
					title : '${panel_title}',
					open : true
				}
			}));
		</script>

		<!--  -->
		<label><spring:message code="task.name" htmlEscape="false" /></label>
		<div>
			<c:out value="${task.name }"></c:out>
		</div>
		<br>


		<!--  -->
		<label><spring:message code="task.duedate" htmlEscape="false" /></label>
		<div>
			<c:out value="${task.dueDate }"></c:out>
		</div>
		<br>

		<!--  -->
		<label><spring:message code="task.priority" htmlEscape="false" /></label>
		<div>
			<c:out value="${task.priority }"></c:out>
		</div>
		<br>

		<!--  -->
		<label><spring:message code="task.create.time" htmlEscape="false" /></label>
		<div>
			<c:out value="${task.createTime }"></c:out>
		</div>
		<br>

		<!--  -->
		<label><spring:message code="task.description" htmlEscape="false" /></label>
		<div>
			<c:out value="${task.description }"></c:out>
		</div>
		<br>

		<!--  -->
		<label><spring:message code="task_process_part" htmlEscape="false" /></label>
		<div>
			<c:url value="/myProcess/${task.processInstanceId }" var="instance_url"></c:url>
			<a href="${instance_url}"><c:out value="${process.name }" /></a>
		</div>
		<br>

		<!-- Claim -->
		<c:url value="/tasks/${task.id }" var="claim_url">
			<c:param name="claim"></c:param>
		</c:url>
		<spring:message code="task.claim" htmlEscape="false" var="button_claim" />
		<form:form action="${claim_url }" method="POST">
			<input type="submit" value="${fn:escapeXml(button_claim)}" <c:if test="${!canClaim }">disabled="disabled"</c:if> alt="${fn:escapeXml(button_claim)}"
				title="${fn:escapeXml(button_claim)}" >
		</form:form>
		<br>

		<!-- 
	<label>Description</label>
	<div>
		<c:out value="${task.description }"></c:out>
		<a href="#">Update</a>
	</div>
	<br>

	<label>Part of process?</label>
	<div>link</div>
	<br> -->


		<!--  -->
		<h3>
			<spring:message code="task.people" htmlEscape="false" />
		</h3>
		<br>

		<!--  -->
		<label><spring:message code="task.owner" htmlEscape="false" /></label>
		<div>
			<c:out value="${task.owner }"></c:out>

			<c:url value="/tasks/${task.id }" var="transfer_url">
				<c:param name="transferForm"></c:param>
			</c:url>
			<a href="${transfer_url }"><spring:message code="task.owner.transfer" htmlEscape="false" /></a>
			<!-- input type="submit" value="Transfer2" onclick="javascript:window.location.href('${transfer_url}');" -->
		</div>
		<br>

		<!--  -->
		<label><spring:message code="task.assignee" htmlEscape="false" /></label>
		<div>
			<c:out value="${task.assignee }"></c:out>

			<c:url value="/tasks/${task.id }" var="reassign_url">
				<c:param name="reassignForm"></c:param>
			</c:url>
			<a href="${reassign_url }"><spring:message code="task.assignee.reassign" htmlEscape="false" /></a>
		</div>
		<br>

		<!-- 
	<label>Involved people</label>
	<div>
		<c:out value="${involvedPeople }"></c:out>
		<a href="#">Involve people</a>
	</div>
	<br> -->

		<!--  
	<h3>Subtasks</h3>
	<br>

	<div>
		xxx <a href="#">Create subtask</a>
	</div>
	<br>

	<h3>Related content</h3>
	<br>

	<div>
		xxx <a href="#">Add related content</a>
	</div>
	<br>-->

		<!--  -->
		<c:if test="${boUrl != null }">
			<h3>
				<spring:message code="task_related_bo" htmlEscape="false" />
			</h3>

			<div>
				<a href="<c:url value="${boUrl }" />"><c:out value="${boUrl }" /></a>
			</div>
			<br>
		</c:if>

		<!--  -->
		<h3>
			<spring:message code="task_form" htmlEscape="false" />
		</h3>
		<br>


		<!--  -->
		<spring:url value="/tasks/${task.id }" var="form_url">
			<spring:param name="complete"></spring:param>
		</spring:url>
		<form:form modelAttribute="taskForm" action="${form_url }" method="POST">


			<c:forEach items="${formProperties }" var="formProperty">

				<label><c:out value="${formProperty.name }" /></label>
				<c:choose>
					<c:when test="${!formProperty.writable }">
						<div>
							<c:out value="${formProperty.value }" />
						</div>
					</c:when>
					<c:when test="${formProperty.type.name=='string' || formProperty.type.name=='long' }">
						<div>
							<form:input path="properties[${formProperty.id }]" disabled="${!canComplete }" />
							<%-- 							<c:if test="${formProperty.required }"> --%>
							<!-- 								<p style="color: red;">*</p> -->
							<%-- 							</c:if> --%>
						</div>
					</c:when>
					<c:when test="${formProperty.type.name=='enum' }">
						<div>
							<form:select path="properties[${formProperty.id }]" disabled="${!canComplete }">
								<form:option value=""></form:option>
								<form:options items="${formProperty.type.getInformation('values') }" />
							</form:select>
							<%-- 							<c:if test="${formProperty.required }"> --%>
							<!-- 								<p style="color: red;">*</p> -->
							<%-- 							</c:if> --%>
						</div>
					</c:when>
				</c:choose>
				<br>
			</c:forEach>

			<spring:message code="task.complete" htmlEscape="false" var="button_label" />
			<input type="submit" value="${fn:escapeXml(button_label)}" <c:if test="${!canComplete }">disabled="disabled"</c:if> alt="${fn:escapeXml(button_label)}"
				title="${fn:escapeXml(button_label)}">
		</form:form>
		<br>
	</div>





</body>
</html>